#include "UserComment.h"
#include <sstream>

using namespace std;

UserComment::UserComment(double userRating, string helpfulness, string userComment) : 
	_rating(userRating), _helpfulness(helpfulness), _comment(userComment) {
	cleanComment();
}

void UserComment::cleanComment() {
	std::string::size_type k = 0;
	while((k=_comment.find('\'',k))!=_comment.npos) {
		_comment.erase(k, 1);
	}
}

/*
void UserComment::writeCommentToDB(sqlite3* db, int movieId) {
	char* error;
	stringstream s;
	string query = "INSERT INTO userComments VALUES(";
	s << query;
	s << movieId << ", " << _rating << ", '" << _helpfulness << "', '" << _comment << "', 0.0);";

	int rc = sqlite3_exec(db, s.str().c_str(), NULL, NULL, &error);
	if(rc) {
		cerr << "Error executing statement " << error << endl;
		sqlite3_free(error);
	}
}
*/

UserComment::UserComment(void)
{
}


UserComment::~UserComment(void)
{
}
